$import( "SmitearWebGL.Objects.Parser.Collada.DaeEntity" );

SmitearWebGL.Objects.Parser.Collada.DaeAnimationClip = SmitearWebGL.Objects.Parser.Collada.DaeEntity.extend(
{
	/******** constructor ********/

	init : function( document, node )
	{
		this.start = 0;
		this.end = 0;
		this.instance_animation = [];

		this._super( document, node );
		this._registClass( "SmitearWebGL.Objects.Parser.Collada.DaeAnimationClip" );
	}
	,
	read : function( node )
	{
		$THROW( node.localName == SmitearWebGL.Objects.Parser.Collada.Const.DAE_ANIMCLIP_ELEMENT,
				"expected a '" + SmitearWebGL.Objects.Parser.Collada.Const.DAE_ANIMCLIP_ELEMENT + "' element" );

		this._super( node );

		$LOG( "reading animation_clip: " + this.id );

		this.name = this.name && this.name.length ? this.name : this.id;
		this.instance_animation = [];
		this.start = this.getAttributeAsFloat( node, SmitearWebGL.Objects.Parser.Collada.Const.DAE_START_ATTRIBUTE );
		this.end = this.getAttributeAsFloat( node, SmitearWebGL.Objects.Parser.Collada.Const.DAE_END_ATTRIBUTE );

		var anims = this.getNodeList( node, SmitearWebGL.Objects.Parser.Collada.Const.DAE_INSTANCE_ANIMATION_ELEMENT );

		for ( var i= 0; i < anims.length; ++ i )
		{
			var url = this.getAttribute( anims[i], SmitearWebGL.Objects.Parser.Collada.Const.DAE_URL_ATTRIBUTE);
			this.instance_animation.push( url );
		}
	}
}
);